#include <head.h>

int main(int argc, char const *argv[])
{

	pid_t pid;
	pid = fork();
	if (pid == -1)
	{
		ERRLOG("创建进程失败！");
	}

	else if (pid > 0)
	{
		printf("我是父进程%d\n", getpid());
		// 用pause()也可以，保证子进程结束前父进程没有结束
		while (1)
		{
			sleep(1);
		}
	}

	else
	{
		printf("我是子进程%d\n", getpid());
		//printf("我的父进程%d\n", getppid());
	}
	return 0;
}